<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <title></title>
  </head>
  <body>

  </body>
  <script type="text/javascript" src="js/jquery-2.1.0.js"></script>
<script type="text/javascript">
$(function(){
    // var preUrl = "http://ecshop.1bpmedia.cn/server/";
    //生产环境配置
    var preUrl = "http://oneshop.1bpcafe.cn/server/";
    //测试环境配置
    // var preUrl = "http://ecshoptest.ebj.ebjcloud.com/ecshop-server/";
    // var preUrl = "http://192.168.2.53:8080/api/ecshop-server/"
    var qs = getQueryString(); 
    var shareCouponNo = qs["shareCouponNo"]; // abc
    
    JumpLink(shareCouponNo);

    function getQueryString() {  
        var qs = location.search.substr(1), // 获取url中"?"符后的字串  
            args = {}, // 保存参数数据的对象
            items = qs.length ? qs.split("&") : [], // 取得每一个参数项,
            item = null,
            len = items.length;
        
        for(var i = 0; i < len; i++) {
            item = items[i].split("=");
            var name = decodeURIComponent(item[0]),
            value = decodeURIComponent(item[1]);
            if(name) {
            args[name] = value;
            }
        }
        return args;
    }
    
    function JumpLink(shareCouponNo) {
        $.ajax({
            type: "POST",
            url: preUrl + 'share/shareCouponLink',
            async: false,
            data: {"shareCouponNo": shareCouponNo},
            success: function (data) {
                window.location.href = data.data.url;
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("获取优惠券链接失败，请稍后重试！");
            }
        });
    }
});
</script>
</html>
